package net.wantongtech.xa.uploadbasicinfo.dao;

import com.wtkj.dao.impl.BaseDataTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 删除历史FastDFS文件DAO
 *
 * @author MaShibo
 * 日期 :  2020/1/31
 */
@Repository
public class DeleteHisFastDFSFileDao extends BaseDataTemplate {

    public List<String> queryDeletingHisReceiveId(int num) {
        /*final String sql =
                "SELECT *\n" +
                        "  FROM (SELECT A.LISTID\n" +
                        "          FROM TQ_INTERACTIONORGMSGRECEIVE A\n" +
                        "         WHERE ((A.CREATEON < TRUNC(SYSDATE) - 20 AND A.STATE = 1) OR\n" +
                        "               A.STATE = 5)\n" +
                        "           AND A.STOREPATH IS NOT NULL\n" +
                        "           AND A.STOREFLAG = 1\n" +
                        "         ORDER BY A.CREATEON DESC)\n" +
                        " WHERE ROWNUM <= ?";*/
        /*final String sql =
                "SELECT *\n" +
                        "  FROM (SELECT A.LISTID\n" +
                        "          FROM TQ_INTERACTIONORGMSGRECEIVE A\n" +
                        "         WHERE A.STATE = 5\n" +
                        "           AND A.STOREPATH IS NOT NULL\n" +
                        "           AND A.STOREFLAG = 1\n" +
                        "         ORDER BY A.CREATEON DESC)\n" +
                        " WHERE ROWNUM <= ?";*/
        /*final String sql =
                "SELECT *\n" +
                        "  FROM (SELECT A.LISTID\n" +
                        "          FROM TQ_INTERACTIONORGMSGRECEIVE A\n" +
                        "         WHERE A.STOREPATH IS NOT NULL\n" +
                        "           AND A.BIZCODE = 8007001\n" +
                        "           AND A.STOREFLAG = 1\n" +
                        "         ORDER BY A.CREATEON DESC)\n" +
                        " WHERE ROWNUM <= ?";*/
        final String sql =
                "SELECT *\n" +
                        "  FROM (SELECT A.LISTID\n" +
                        "          FROM TQ_INTERACTIONORGMSGRECEIVE A\n" +
                        "         WHERE A.STOREPATH IS NOT NULL\n" +
                        "           AND A.BIZCODE = 61011001\n" +
                        "           AND A.STOREFLAG = 1\n" +
                        "           AND A.STATE = 1\n" +
                        "           AND A.CREATEON > DATE '2020-01-20'\n" +
                        "           AND A.CREATEON < TRUNC(SYSDATE) - 5\n" +
                        "         ORDER BY A.CREATEON DESC)\n" +
                        " WHERE ROWNUM <= ?";
        return jdbcTemplate.query(sql, (rs, i) -> rs.getString(1), num);
    }
}
